const KeyCodeMap = {
    enter: 'Enter',
    delete: ['Backspace', 'Delete'],//delete这个按钮修饰符对应2个按键
    up: 'ArrowUp',
    down: 'ArrowDown',
    left: 'ArrowLeft',
    right: 'ArrowRight',
    space: 'Space'
}
//let {keyCode} = event;
//当我按下回车键的时候， keyCode就是Enter
let keyCode = 'Enter';
//获取修饰符指定的编码
let modifiers = ['up','enter','delete','prevent','stop'];
let modifierKeyCodes = modifiers.map(modifier=>KeyCodeMap[modifier]).filter(Boolean).flat();//['Enter']
console.log(modifierKeyCodes)
if(modifierKeyCodes.includes(keyCode)){
    console.log('校验通过')
}else{
    console.log('未通过')
}